package com.yanyilu.basing.controller;


import com.yanyilu.basing.common.R;
import com.yanyilu.basing.jwt.JwtIgnore;
import com.yanyilu.basing.service.ICountPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Sxx
 * @since 2020-10-30
 */
@CrossOrigin
@RestController
@RequestMapping("/countPoint")
public class CountPointController {
    @Autowired
    ICountPointService countPointService;

    @JwtIgnore
    @PostMapping("/frontned/add")
    public R addPointCount(@RequestParam("pointType")Integer pointType){
        return countPointService.addPoint(pointType);
    }
    /**
     * 统计数据列表
     * @param page
     * @param limit
     * @return
     */
    @RequestMapping("/admin/list")
    public R adminList(@RequestParam("page")Integer page,
                       @RequestParam("limit")Integer limit,
                       @RequestParam(value = "startTime",required = false)String startTime,
                       @RequestParam(value = "btnName",required = false)String btnName){
        if(!(null!=btnName)){
            btnName = "";
        }
        if(!(null!=startTime)){
            startTime = "";
        }
        return countPointService.adminList(page,limit,startTime,btnName);
    }

}
